﻿using System;
using System.Collections.Generic;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace WebProfileBuilder {
    public class BuildWebProfile : Task {
        private string _language;

        /// <summary>
        /// Run the task.
        /// </summary>
        /// <returns>true if task succeeded false otherwise</returns>
        public override bool Execute() {
            Builder.Generate(this);
            return true;
        }

        public string ClassName { get; set; }

        public string Directory { get; set; }

        public string FileName { get; set; }

        /// <summary>
        /// Language to write.
        /// Defaults to C#.
        /// </summary>
        /// <example>CSharp, C#, vb, VisualBasic, Visual Basic</example>
        public string Language {
            get { return _language.ToLower() ?? string.Empty; }
            set { _language = value; }
        }

        /// <summary>
        /// NameSpace to use for the profile class.
        /// </summary>
        [Required]
        public string RootNamespace { get; set; }

        /// <summary>
        /// The root directory of the web application project.
        /// </summary>
        [Required]
        public string WebSiteRoot { get; set; }
    }
}
